<?php

namespace App\Http\Middleware;

use Closure;

class BeforeAnyDbQuery
{
    public function handle($request, Closure $next)
    {
        if (\App::environment('local')) {
            // The environment is local
//            \DB::enableQueryLog();
        }
        return $next($request);
    }

    public function terminate($request, $response)
    {
        // Store or dump the log data...
        if (\App::environment('local')) {
//            print_r(
//                \DB::getQueryLog()
//            );
        }
    }
}
